<script>
// 顶部tab+页面切换
import { defineComponent } from 'vue'
export default defineComponent({
	name: 'WeworkQr'
})
</script>
<script setup>
import {
		ref
} from 'vue'
import {reqClientInfo,clientupdintegral,clientupdscore} from '@/api'
import { toRaw } from '@vue/reactivity';
const props = defineProps({
  form: {
    type: Object,
    default: {},
  },
})
const dialogVisible =ref(false)
const integraldata = ref()
const integralType = ref('1')
const editscore=()=>{
  dialogVisible.value=true
}
const integralupdata = ()=>{
  clientupdintegral({ids:[props.form.id],type:integralType.value,
  size:integraldata.value}).then(res=>{
		integraldata.value=''
		ElMessage({
				message: '修改成功',
				type: 'success',
			})
      dialogVisible.value=false
      emits('diaUpdate')
      console.log('ASDASDASD')

  })
  
}

const scoredata = ref()
const scoreType = ref('1')
const scoreshow=ref (false)
const scoremodify = ()=>{
	scoreshow.value=true
}
const scoreupdata = ()=>{
	clientupdscore({ids:[props.form.id],size:scoredata.value,type:scoreType.value}).then(res=>{
		scoredata.value=''
		ElMessage({
				message: '修改成功',
				type: 'success',
			})
      scoreshow.value=false
      emits('diaUpdate')
      console.log('34444ASDASDASD')
	})
}
const emits = defineEmits(['diaUpdate'])
const show = async (val)=>{
  
}
defineExpose({
  show
});
</script>
<template>
	<div class="app-edit app-gap-block" style="margin-right:0px">
    <div class="app-container c-d-b-w310">
      <div class="a-bottom-line a-pb20">
			<div class="app-flex-left">
        <el-button class="a-p05" plain size="small" @click="scoremodify()" >修改评分</el-button>
        <!-- <el-button class="a-p05" plain size="small">添加事件</el-button> -->
        <el-button class="a-p05" plain size="small"  @click="editscore()">修改积分</el-button>
        <!-- <el-button class="a-p05" plain size="small">添加跟进</el-button> -->
      </div>
      <div class="app-flex-left a-mt24">
        <div class="app-flex-center-column a-w100h100">
          <div class="a-word-800 a-word-12">客户评分</div>
          <div class="a-word-14 a-word-800 app-primary-font">{{form.score}}</div>
        </div>
        <el-avatar :size="80" :src="form.avatar" />
      
       <div class="app-flex-center-column a-w100h100">
          <div class="a-word-800 a-word-12">客户积分</div>
          <div class="a-word-14 a-word-800 app-primary-font">{{form.integral}}</div>
        </div>
      </div>
      <div class="app-flex-center-column">
         <div class="a-word-800 a-word-16">{{form.name}}</div>
          <div class="a-word-14 app-success-font a-word-12">{{form.type == 1 ? '微信' : '企业'}}</div>
      </div>

      <div class="a-mt24 a-word-12">
        <div class="a-word-800">企业标签：</div>
        <div class="a-mt8"  v-for="item in form.tags">
          <span class="app-grey6-font">{{item.group.group_name}}:</span>
          <span v-for="item in item.tag">
          <el-popover v-if="item.deleted==0"

											popper-style="padding: 10px;min-width:0px"
											placement="right"
											:width="100"
											trigger="hover"
										>
											<div>已删除</div>
											<template #reference>
												<el-tag :type="item.deleted==1?'':'info'" class="app-br-10">
                            <span class="app-regular-font" >{{item.tag_name}}</span>
                      </el-tag>
											</template>
										</el-popover>

          <el-tag v-else :type="item.deleted==1?'':'info'" class="app-br-10" >
								<span class="app-regular-font" >{{item.tag_name}}</span>
          </el-tag>
        </span>
        </div>
         <!-- <div class="a-ml24 a-mt8">
          <span class="app-grey6-font">客户等级：</span>
          <el-tag class="app-br-10">
								<span class="app-regular-font">567567</span>
          </el-tag>
        </div> -->

      </div>

            <!-- <div class="a-mt24 a-word-12">
        <div class="a-word-800">个人标签：</div>
        <div class="a-ml24 a-mt8">
          <span class="app-grey6-font">标签类别：</span>
          <el-tag class="app-br-10">
								<span class="app-regular-font">567567</span>
          </el-tag>
        </div> -->

      <!-- </div> -->
      </div>

      <div class="a-mt24">
        <div class="app-detail-title-color-underline">基本信息</div>
         <div class="a-mt20 a-word-12">
        <div class="a-word-800" style="margin-top: 10px;">性别：<span class="app-grey6-font a-word-400">{{ form.gender==1?'男': form.gender==2?'女':''}}</span></div>
        <div class="a-word-800" style="margin-top: 10px;">年龄：<span class="app-grey6-font a-word-400">{{ form.age}}</span></div>
        <div class="a-word-800" style="margin-top: 10px;">手机号：<span class="app-grey6-font a-word-400">{{ form.remark_mobiles}}</span></div>
        <div class="a-word-800" style="margin-top: 10px;">QQ：<span class="app-grey6-font a-word-400">{{ form.qq}}</span></div>
        <div class="a-word-800" style="margin-top: 10px;">生日：<span class="app-grey6-font a-word-400">{{ form.birthday}}</span></div>
        <div class="a-word-800" style="margin-top: 10px;">邮箱：<span class="app-grey6-font a-word-400">{{ form.email}}</span></div>
        <!-- <div class="a-word-800" style="margin-top: 10px;">来源：<span class="app-grey6-font a-word-400">{{ form.add_way}}</span></div> -->
        <div class="a-word-800" style="margin-top: 10px;">备注：<span class="app-grey6-font a-word-400">{{ form.enterprise}}</span></div>
        <div class="a-word-800" style="margin-top: 10px;">地址：<span class="app-grey6-font a-word-400">{{ form.address}}</span></div>
      </div>
      <!-- <div class="a-mt8 a-word-12">
        <div class="a-word-800">性别：<span class="app-grey6-font a-word-400">324234</span></div>
      </div> -->
      </div>

  </div>
  <div>
    <el-dialog
    v-model="dialogVisible"
    title="修改积分"
    width="30%"
    :before-close="handleClose"
  >
  <div style="padding-left:20px" class="app-flex-left">
				<span>积分:</span>
        <span style="margin-left: 5px;">
        <el-select v-model="integralType" class="m-2" style="width:100px" placeholder="">
          <el-option
            label="增加"
            value="1"
          />
           <el-option
            label="减少"
            value="2"
          />
        </el-select>
        </span>
				<span style="margin-left: 5px;"><el-input v-model="integraldata" placeholder="请输入积分" style="width: 200px;" type="number" /></span>
			</div>
    <template #footer>
      <span class="dialog-footer">
        <el-button @click="dialogVisible = false">取消</el-button>
        <el-button type="primary" @click="integralupdata()">
          确定
        </el-button>
      </span>
    </template>
  </el-dialog>
  <el-dialog
			v-model="scoreshow"
			title="修改评分"
			width="30%"
			:before-close="handleClose"
		>
			<div style="padding-left:20px" class="app-flex-left">
				<span>评分:</span>
        <span style="margin-left: 5px;">
        <el-select v-model="scoreType" class="m-2" style="width:100px" placeholder="">
          <el-option
            label="增加"
            value="1"
          />
           <el-option
            label="减少"
            value="2"
          />
        </el-select>
        </span>
				<span style="margin-left: 5px;"><el-input v-model="scoredata" placeholder="请输入评分" style="width: 200px;" type="number" /></span>
			</div>
			<template #footer>
			<span class="dialog-footer">
				<el-button @click="scoreshow = false">取消</el-button>
				<el-button type="primary" @click="scoreupdata()">
				确定
				</el-button>
			</span>
			</template>
		</el-dialog>
  </div>
  </div>

</template>
<style lang="scss">
.c-d-b-w310{
  width:310px;
}
	@import url('../../../../../style/app-component.scss');
	@import '../../../../../style/mixin.scss';
</style>